const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const merge = require('webpack-merge');
const {CleanWebpackPlugin} = require('clean-webpack-plugin')
const webpackBaseConfig = require('./webpack.base.config.js');
const envProd = require('./src/config/env-prod')

module.exports = merge(webpackBaseConfig, {
    plugins: [
        new CleanWebpackPlugin(),
        new ExtractTextPlugin({
            filename: 'css/[name].[hash:8].css',
            allChunks: true
        }),
        new webpack.optimize.CommonsChunkPlugin({
            name: 'vendors',
            filename: 'vendors.js'
        }),
        new webpack.DefinePlugin({
            ENV: '"prod"',
            env_config: `${JSON.stringify(envProd)}`
        }),
    ]
});